package com.ruoyi.zxjd.work.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable3;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable3Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 党风廉政建设外宣稿件情况统计Controller
 * 
 * @author lcc
 * @date 2021-02-25
 */
@Controller
@RequestMapping("/work/templatetable3")
public class WorkTemplateTable3Controller extends BaseController
{
    private String prefix = "work/templatetable3";

    @Autowired
    private IWorkTemplateTable3Service workTemplateTable3Service;

    @RequiresPermissions("work:templatetable3:view")
    @GetMapping()
    public String templatetable3()
    {
        return prefix + "/templatetable3";
    }

    /**
     * 查询党风廉政建设外宣稿件情况统计列表
     */
    @RequiresPermissions("work:templatetable3:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WorkTemplateTable3 workTemplateTable3)
    {
        startPage();
        List<WorkTemplateTable3> list = workTemplateTable3Service.selectWorkTemplateTable3List(workTemplateTable3);
        return getDataTable(list);
    }

    /**
     * 导出党风廉政建设外宣稿件情况统计列表
     */
    @RequiresPermissions("work:templatetable3:export")
    @Log(title = "党风廉政建设外宣稿件情况统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WorkTemplateTable3 workTemplateTable3)
    {
        List<WorkTemplateTable3> list = workTemplateTable3Service.selectWorkTemplateTable3List(workTemplateTable3);
        ExcelUtil<WorkTemplateTable3> util = new ExcelUtil<WorkTemplateTable3>(WorkTemplateTable3.class);
        return util.exportExcel(list, "templatetable3");
    }

    /**
     * 新增党风廉政建设外宣稿件情况统计
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存党风廉政建设外宣稿件情况统计
     */
    @RequiresPermissions("work:templatetable3:add")
    @Log(title = "党风廉政建设外宣稿件情况统计", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WorkProgressBO workProgressBO)
    {
        return toAjax(workTemplateTable3Service.insertWorkTemplateTable3(workProgressBO));
    }

    /**
     * 修改党风廉政建设外宣稿件情况统计
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        WorkTemplateTable3 workTemplateTable3 = workTemplateTable3Service.selectWorkTemplateTable3ById(id);
        mmap.put("workTemplateTable3", workTemplateTable3);
        return prefix + "/edit";
    }

    /**
     * 修改保存党风廉政建设外宣稿件情况统计
     */
    @RequiresPermissions("work:templatetable3:edit")
    @Log(title = "党风廉政建设外宣稿件情况统计", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WorkTemplateTable3 workTemplateTable3)
    {
        return toAjax(workTemplateTable3Service.updateWorkTemplateTable3(workTemplateTable3));
    }

    /**
     * 删除党风廉政建设外宣稿件情况统计
     */
    @RequiresPermissions("work:templatetable3:remove")
    @Log(title = "党风廉政建设外宣稿件情况统计", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(workTemplateTable3Service.deleteWorkTemplateTable3ByIds(ids));
    }
}
